<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
    test(() => assert_selection(
        [
            '<div contenteditable>',
                '<ol>',
                    '<li>|</li>',
                    '<li>foo bar</li>',
                '</ol>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('selectAll');
            selection.document.execCommand('insertOrderedList');
        },
        [
            '<div contenteditable>',
                // TODO(yosin): We should study why unlistify sets caret before
                // last character.
                '^<br>foo ba|r',
            '</div>',
        ].join('')),
        'Unlistify with an empty list item');
</script>
